
<template>
  <div>
    <h1 ref="count">猜猜我是谁</h1>
    <div>{{count}}</div>
      <button @click="add">点击</button>
  </div>
  <!-- 和react一样,在dom上添加ref属性,可以在实例上的refs属性上拿到真实dom -->
</template>

<script>
export default {
    name:"Count",
    data() {
    return {
      count: 0,
    };
  },
  methods: {
    add() {
      this.count++;
      console.log(this.$refs);
      console.log(this.$refs.count);
    },
  },
}
</script>

<style>

</style>